import request from '@/utils/request'
// 获取学生列表
export const getStudentList = (id) => request.get('api/student', { params: { clazz_id: id } })
// 新增学生
export const addStudent = (data) => request.post('api/student/', data)
// 删除学生
export const deleteStudent = (id) => request.delete(`api/student/${id}/`)
// 更新学生
export const updateStudent = (id, data) => request.put(`api/student/${id}/`, data)
// 获取学生个人信息（拿成绩）
export const getStudentDetail = (id) => request.get(`api/student/${id}/`)

// 课程班级学生管理API
// 5.10 在班级下创建学生
export const addClassStudent = (course_id, class_id, data) =>
  request.post(`api/course/management/${course_id}/classes/${class_id}/students/`, data)

// 5.11 更新学生信息
export const updateClassStudent = (course_id, class_id, student_id, data) =>
  request.put(`api/course/management/${course_id}/classes/${class_id}/students/${student_id}/`, data)

// 5.12 删除学生
export const deleteClassStudent = (course_id, class_id, student_id) =>
  request.delete(`api/course/management/${course_id}/classes/${class_id}/students/${student_id}/`)

// 获取班级学生列表
export const getClassStudents = (course_id, class_id) =>
  request.get(`api/course/management/${course_id}/classes/${class_id}/students/`)
